<template>
    <div class="integralMarket">
        <div class="content">
            <template v-for="(i, idx) in integralMarketList" :key="idx">
                <nut-card
                    :img-url="i.bannerImgs[0]"
                    :title='i.name + " | " + i.header'
                    :is-need-price="false"
                    class="content-item"
                    @click="GoBuy(i)"
                >
                    <template #shop-tag>
                        <div class="item-integral">{{i.price}}积分</div>
                    </template>
                </nut-card>
            </template>
        </div>
    </div>
  </template>
  
  <script>
 import { onMounted, reactive, toRefs } from 'vue';
  import './index.scss';
  import { GetIntegralMarketList } from '../utils/api.js' 
  import { Del, Edit, Checklist } from '@nutui/icons-vue-taro';
  import Taro from '@tarojs/taro'
  import currency from 'currency.js'
import { stat } from 'fs';
  export default {
    name: 'Index',
    components: {
        Del,Edit,Checklist
    },
    setup(){
        const state = reactive({
            integralMarketList: [],
            imgUrl:
                '//img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
            title: '活蟹】湖塘煙雨 阳澄湖大闸蟹公4.5两 母3.5两 4对8只 鲜活生鲜螃蟹现货水产礼盒海鲜水',
            price: '388',
            vipPrice: '378',
            shopDesc: '自营',
            delivery: '厂商配送',
            shopName: '阳澄湖大闸蟹自营店>'
        });
        const GetIntegralMarket = async () => {
            let integralMarketRes = await GetIntegralMarketList({});
            if(integralMarketRes.code == 200) {
                state.integralMarketList = integralMarketRes.data.list;
            }
        }
        onMounted(() => {
            GetIntegralMarket();
        })
        // 购买
        const GoBuy = (tarVal) => {
            Taro.navigateTo({
                url: `/pages/commodity-closeAnAccount/index?entryType=3&commodityId=${tarVal.id}`
            })
        }
        return {
            GoBuy,
            ...toRefs(state),
        }
    }
  }
  </script>
  
  